package org.karson.designpattern.behavioral.Interpreter.list;


public class Demo {
    public static void main(String[] args) {
        ArrayList<String> names = new ArrayList<>();
        names.add("xzg");
        names.add("wang");
        names.add("zheng");

        Iterator<String> iterator = names.iterator();//new ArrayIterator(names);
        while (iterator.hasNext()) {
            System.out.println(iterator.currentItem());
            iterator.next();
        }
    
        /**
        iterator.next();
        names.remove("a");
        iterator.next();//抛出ConcurrentModificationException异常
         */
    }
}